package com.ty.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ty.dao.MasterDao;
import com.ty.entity.Master;
import com.ty.service.MasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * (Master)表服务实现类
 *
 * @author makejava
 * @since 2020-12-01 22:17:51
 */
@Service("masterService")
public class MasterServiceImpl extends ServiceImpl<MasterDao, Master> implements MasterService {

    @Autowired
    private MasterDao masterDao;

    @Override
    public PageInfo<Master> getPage(Master master, Integer page, Integer limit) {
        //开启分页
        PageHelper.startPage(page, limit);
        //查询数据
        List<Master> list = this.masterDao.getPage(master);

        //数据封装到PageInfo中
        PageInfo<Master> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<Master> getAll() {
        return  this.masterDao.getPage(null);
    }

}